import request from "@/utils/request.js";

export function getCombinationList(data) {
  return request.get('combination/list', data,{noAuth:true});
}


export function getCombinationDetail(id) {
  return request.get('combination/detail/'+id);
}


export function getCombinationPink(id) {
  return request.get("combination/pink/" + id);
}


export function postCombinationRemove(data) {
  return request.post("combination/remove",data);
}


export function getCombinationMore(data) {
  return request.get("combination/more",data,{noAuth:true});
}


export function getBargainList(data) {
  return request.get("bargain/list", data,{noAuth:true});
}


export function getBargainUserList(data){
  return request.get('bargain/record',data);
}


export function bargainUserCancel(bargainId){
  return request.post('bargain/user/cancel', { bargainId: bargainId})
}


export function getBargainDetail(id) {
  return request.get("bargain/detail/" + id);
}


export function getBargainUser(data) {
  return request.get("bargain/user", data);
}



export function postBargainStart(bargainId) {
  return request.post("bargain/start", { bargainId: bargainId});
}


export function postBargainHelp(data) {
  return request.post("bargain/help", data);
}


export function postBargainHelpPrice(data) {
  return request.post("bargain/help/price", data);
}


export function postBargainHelpList(params,data) {
  return request.get("bargain/help/list?limit="+params.limit+"&page="+params.page, data,{});
}


export function getSeckillIndexTime(){
  return request.get('seckill/index',{},{noAuth:true});
}
// ***************************************************************************************

// export function getSeckillList(time,data){
//   return request.get('seckill/list/'+time,data,{noAuth:true});
// }
export function getSeckillList(time){
  return request.get('seckill/list/'+time,{noAuth:true});
}


/**
 * 抢拍用户预约/取消
 * 
 * @param int id
*/
export function appointMent(id){
  return request.get("reservation?seckillId="+id,{noAuth:true});
}

/**
 * 点击抢拍按钮 查询是否 已预约
 * 
 * @param int id
*/
export function continueState(id){
  return request.get('reservation/continuePhotos?seckillId='+id,{noAuth:true});
}
export function payMent(data){
  return request.post('pay/payMent',data,{noAuth:true});
}

/**
 * 抢拍创建预订单
 * 
 * @param object data
*/
export function getOrderState(data){
  return request.post('order/create',data,{noAuth:true});
}


/**
 * 用户创建预订单
 * 
 * @param object data
*/
export function orderPre(data){
  return request.post('order/pre/order',data,{noAuth:true});
}
// *****************************************************************************************************

/**
 * 秒杀产品详情
 * @param int id
*/
export function getSeckillDetail(id){
  return request.get('seckill/detail/'+id);
}

/**
 * 砍价海报
 * @param object data
 * 
*/
export function getBargainPoster(data){
  return request.post('bargain/poster',data)
}

/**
 * 拼团海报
 * @param object data
 * 
*/
export function getCombinationPoster(data){
  return request.post('combination/poster',data)
}

/**
 * 砍价取消
 */
export function getBargainUserCancel(data) {
  return request.post("/bargain/user/cancel", data);
}


export function seckillCode(id,data) {
  return request.get("seckill/code/"+id,data);
}


export function scombinationCode(id) {
  return request.get("combination/code/"+id);
}

/**
 * 秒杀产品时间区间
 * @param int id
*/
export function getSeckillHeaderApi(){
  return request.get('seckill/header',{},{noAuth:true});
}

/**
 * 首页产品列表
*/
export function getSeckillIndexApi(){
  return request.get('seckill/index',{},{noAuth:true});
}



export function getCombinationIndexApi(){
  return request.get('combination/index',{},{noAuth:true});
}


export function getBargainIndexApi(){
  return request.get('bargain/index',{},{noAuth:true});
}

export function bargainHeaderApi(){
  return request.get('bargain/header');
}

/**
 * 拼图列表头部
*/
export function combinationHeaderApi(){
  return request.get('combination/header');
}